package net.csdn.business.notify.api.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.csdn.business.notify.common.model.dto.NewNotifyUserSettingDTO;
import net.csdn.business.notify.common.model.dto.UpdateNotifyUserSettingDTO;
import net.csdn.business.notify.common.model.query.NotifyUserSettingQuery;
import net.csdn.business.notify.common.model.vo.NotifyUserSettingVO;
import net.csdn.business.notify.api.service.INotifyUserSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通知中心-用户通知配置Controller
 * 
 * @author ruoyi
 * @date 2023-11-27
 */
@RestController
@RequestMapping("/api/v1/notify/userSetting")
public class NotifyUserSettingController
{
    @Autowired
    private INotifyUserSettingService notifyUserSettingService;

    /**
     * 分页查询通知中心-用户通知配置列表
     */
    @GetMapping("/list")
    public Page<NotifyUserSettingVO> findPageList(NotifyUserSettingQuery query)
    {
        return notifyUserSettingService.findPageList(query);
    }


    /**
     * 根据id获取通知中心-用户通知配置详细信息
     */
    @GetMapping(value = "/{id}")
    public NotifyUserSettingVO getInfo(@PathVariable("id") String id)
    {
        return notifyUserSettingService.selectNotifyUserSettingById(id);
    }

    /**
     * 新增通知中心-用户通知配置
     */
    @PostMapping
    public Integer add(@RequestBody NewNotifyUserSettingDTO notifyUserSetting)
    {
        return notifyUserSettingService.insertNotifyUserSetting(notifyUserSetting);
    }

    /**
     * 修改通知中心-用户通知配置
     */
    @PutMapping
    public Integer edit(@RequestBody UpdateNotifyUserSettingDTO notifyUserSetting)
    {
        return notifyUserSettingService.updateNotifyUserSetting(notifyUserSetting);
    }

    /**
     * 删除通知中心-用户通知配置
     */
	@DeleteMapping("/{id}")
    public Integer remove(@PathVariable("id")  String id)
    {
        return notifyUserSettingService.deleteNotifyUserSettingById(id);
    }
}
